package com.tchy.cloud.entity;

import javax.persistence.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import static javax.persistence.GenerationType.IDENTITY;

/**
 * Created by xmweilove
 * 量表分类信息
 */
@Entity
@Table(name = "c_questionnaire_sort", schema = "", catalog = "")
public class CQuestionnaireSortEntity {
    //    private Integer parentId;//父id
    private CQuestionnaireSortEntity parentQS;//上级分类
    private Integer qsId;//主键
    private String name;//名称
    private Integer sort;//排序序号
    private String qDesc;//描述
    private String qlevel;//等级关系
    private Date createTime;//创建时间
    private List<CQuestionnaireSortEntity> childresQS = new ArrayList<CQuestionnaireSortEntity>();//下级分类


    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "parent_id")
    public CQuestionnaireSortEntity getParentQS() {
        return parentQS;
    }

    public void setParentQS(CQuestionnaireSortEntity parentQS) {
        this.parentQS = parentQS;
    }


    @Id
    @GeneratedValue(strategy = IDENTITY)
    @Column(name = "questionnaire_sort_id")
    public Integer getQsId() {
        return qsId;
    }

    public void setQsId(Integer qsId) {
        this.qsId = qsId;
    }

    @Basic
    @Column(name = "name")
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }


    @Basic
    @Column(name = "sort")
    public Integer getSort() {
        return sort;
    }

    public void setSort(Integer sort) {
        this.sort = sort;
    }


    @Basic
    @Column(name = "question_desc")
    public String getqDesc() {
        return qDesc;
    }

    public void setqDesc(String qDesc) {
        this.qDesc = qDesc;
    }


    @Basic
    @Column(name = "qlevel")
    public String getQlevel() {
        return qlevel;
    }

    public void setQlevel(String qlevel) {
        this.qlevel = qlevel;
    }



    @Basic
    @Column(name = "create_time")
    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "parentQS")
    public List<CQuestionnaireSortEntity> getChildresQS() {
        return childresQS;
    }

    public void setChildresQS(List<CQuestionnaireSortEntity> childresQS) {
        this.childresQS = childresQS;
    }
}
